Method and apparatus for determining zero-crossing of an AC input voltage to a power supply

ABSTRACT

An example controller for a switched mode power supply includes a drive signal generator and a zero-crossing detector. The drive signal generator is to be coupled to control switching of a switch included in the power supply to regulate an output of the power supply. The zero-crossing detector is coupled to the drive signal generator and coupled to receive a current sense signal representative of a switch current flowing through the switch. The zero-crossing detector generates a zero-crossing signal in response to comparing the current sense signal with a reference signal representative of a zero-crossing current threshold. The zero-crossing signal indicates when a zero-crossing condition of an ac line input voltage of the power supply exists.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates generally to power supplies, and morespecifically to controllers for switched mode power supplies.

2. Discussion of the Related Art

Electronic devices use power to operate. Switched mode power suppliesare commonly used due to their high efficiency, small size and lowweight to power many of today's electronics. Conventional wall socketsprovide a high voltage alternating current. In a switching power supplya high voltage alternating current (ac) input is converted to provide awell regulated direct current (dc) output through an energy transferelement. The switched mode power supply control circuit usually providesoutput regulation by sensing the output and controlling it in a closedloop. In operation, a switch is utilized to provide the desired outputby varying the duty cycle (typically the ratio of the on time of theswitch to the total switching period) of the switch in a switched modepower supply.

Requirements such as efficiency, size, weight and cost are usually takeninto account when designing a switched mode power supply. Typically, thecontroller which controls the switching of the switched mode powersupply is designed as an integrated circuit with various terminals whichmay function as input terminals, output terminals or both. When theswitch of a switched mode power supply is integrated with thecontroller, two terminals of the integrated circuit correspond to thetwo ends of the switch. Various terminals of the integrated circuit maybe utilized as the feedback terminal, a function program terminal, or aninput voltage sense terminal for the controller. For some applicationsof the switched mode power supply, the ac input voltage is sensed todetermine the zero-crossing of the ac input voltage. In general, the acinput voltage is herein also referred to as the line input voltage. Thezero-crossing generally refers to when the ac input voltage crosses zerovoltage. In other words, the zero-crossing refers to when the magnitudeof the ac input voltage changes sign from positive to negative or fromnegative to positive. The zero-crossing of the line input voltage may beused for various applications. The zero-crossing of the line inputvoltage maybe used to determine the ac line frequency or it may be usedto update the internal clock of a controller of a power supply.

In one type of dimming for lighting applications, a triac dimmer circuittypically removes a portion of the ac input voltage to limit the amountof voltage and current supplied to an incandescent lamp. This is knownas phase dimming because it is often convenient to designate theposition of the missing voltage in terms of a fraction of the period ofthe ac input voltage measured in degrees. In general, the ac inputvoltage is a sinusoidal waveform and the period of the ac input voltageis referred to as a full line cycle. As such, half the period of the acinput voltage is referred to as a half line cycle. An entire period ofthe ac input voltage has 360 degrees, and a half line cycle has 180degrees. Typically, the phase angle is a measure of how many degrees(from a reference of zero degrees) of each half line cycle the dimmercircuit removes. Although phase angle dimming works well withincandescent lamps that receive the altered ac line voltage directly, ittypically creates problems for light emitting diode (LED) lamps. LEDlamps require a regulated power supply to provide regulated current andvoltage from the ac power line. Conventional regulated power suppliesare typically designed to ignore distortions of the ac input voltage.Their purpose is to deliver a constant regulated output until a lowinput voltage causes them to shut off completely. As such, conventionalregulated power supplies would not dim the LED lamp. Unless a powersupply for an LED lamp is specially designed to recognize and respond tothe voltage from a triac dimmer circuit in a desirable way, a triacdimmer is likely to produce unacceptable results such as flickering ofthe LED lamp, flashing of the LED lamp at high phase angles, and colorshifting of the LED lamp. Thus, a power supply may include an improvedconventional power supply controller that is designed to respond to atriac dimmer circuit by directly sensing the ac input voltage todetermine when the ac input voltage is cut-off due to the dimmingcircuit. The ac input voltage is directly sensed with circuitry externalfrom the integrated circuit of the conventional controller. The sensedac input voltage may be received by the integrated circuit of theimproved conventional controller at an additional terminal dedicated toreceiving the sensed ac input voltage or at a multifunction terminal inconjunction with external circuitry. Additional terminals, however, addunwanted cost and size to the conventional controller of the switchedmode power supply and circuitry external to the integrated circuit ofthe conventional controller adds cost to the switched mode power supply.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other aspects, features and advantages of severalembodiments of the present invention will be more apparent from thefollowing more particular description thereof, presented in conjunctionwith the following drawings.

FIG. 1 is a functional block diagram illustrating an example switchingpower supply utilizing a controller in accordance with an embodiment ofthe present invention.

FIG. 2A is a diagram illustrating an example rectified input voltagewaveform of the switching power supply of FIG. 1 in accordance with anembodiment of the present invention.

FIG. 2B is a diagram illustrating a portion of the example rectifiedinput voltage of FIG. 2A and corresponding zero-crossing signal inaccordance with an embodiment of the present invention.

FIG. 3 is a diagram illustrating an example switch current waveform of aswitching power supply operating in continuous conduction mode (CCM) anddiscontinuous conduction mode (DCM) in accordance with an embodiment ofthe present invention.

FIG. 4A is a diagram illustrating an example switch current waveform ofa switching power supply operating in DCM and correspondingzero-crossing signal in accordance with an embodiment of the presentinvention.

FIG. 4B is a diagram illustrating another example of the switch currentwaveform of a switching power supply operating in DCM and correspondingzero-crossing signal in accordance with an embodiment of the presentinvention.

FIG. 5 is a diagram illustrating an example switch current waveform andcorresponding zero-crossing signal in accordance with an embodiment ofthe present invention.

FIG. 6 is a functional block diagram illustrating an example switchingpower supply utilizing a dimmer circuit and a controller in accordancewith an embodiment of the present invention.

FIG. 7A is a diagram illustrating an example rectified input voltagewaveform of the switching power supply of FIG. 6 in accordance with anembodiment of the present invention.

FIG. 7B is a diagram illustrating a portion of the example rectifiedinput voltage of FIG. 7A and corresponding zero-crossing signal inaccordance with an embodiment of the present invention.

FIG. 8A is a diagram illustrating another example rectified inputvoltage waveform of a switching power supply in accordance with anembodiment of the present invention.

FIG. 8B is a diagram illustrating a portion of the example rectifiedinput voltage of FIG. 8A and corresponding zero-crossing signal inaccordance with an embodiment of the present invention.

FIG. 9A is a functional block diagram of a controller in accordance withan embodiment of the present invention.

FIG. 9B is a functional block diagram of an on-time extension block ofthe controller of FIG. 9A in accordance with an embodiment of thepresent invention.

FIG. 10 is a diagram illustrating various waveforms of signals of thecontroller and on-time extension block of FIGS. 9A and 9B in accordancewith an embodiment of the present invention.

Corresponding reference characters indicate corresponding componentsthroughout the several views of the drawings. Skilled artisans willappreciate that elements in the figures are illustrated for simplicityand clarity and have not necessarily been drawn to scale. For example,the dimensions of some of the elements in the figures may be exaggeratedrelative to other elements to help to improve understanding of variousembodiments of the present invention. Also, common but well-understoodelements that are useful or necessary in a commercially feasibleembodiment are often not depicted in order to facilitate a lessobstructed view of these various embodiments of the present invention.

DETAILED DESCRIPTION

Embodiments of a method and apparatus for determining the zero-crossingof an ac input voltage to a power supply are described herein. In thefollowing description numerous specific details are set forth to providea thorough understanding of the embodiments. One skilled in the relevantart will recognize, however, that the techniques described herein can bepracticed without one or more of the specific details, or with othermethods, components, materials, etc. In other instances, well-knownstructures, materials, or operations are not shown or described indetail to avoid obscuring certain aspects.

Reference throughout this specification to “one embodiment”, “anembodiment”, “one example” or “an example” means that a particularfeature, structure or characteristic described in connection with theembodiment or example is included in at least one embodiment of thepresent invention. Thus, appearances of the phrases “in one embodiment”,“in an embodiment”, “one example” or “an example” in various placesthroughout this specification are not necessarily all referring to thesame embodiment or example. Furthermore, the particular features,structures or characteristics may be combined in any suitablecombinations and/or sub combinations in one or more embodiments orexamples. In addition, it is appreciated that the figures providedherewith are for explanation purposes to persons ordinarily skilled inthe art and that the drawings are not necessarily drawn to scale.

For some applications of switched mode power supplies, the dc inputvoltage is sensed to determine the zero-crossing of the ac inputvoltage. For phase dimming applications, including those for lightemitting diodes (LEDs), the duration of the zero-crossing of the acinput voltage would be sensed by a power supply controller. Determiningthe duration of the zero-crossing of the ac input voltage would indicateto the power supply controller that a dimmer circuit is being utilizedand hence alter the quantity to the output of the power supply isregulated. Typically, the ac input voltage is directly sensed withcircuitry external to the integrated circuit of the conventionalcontroller designed to respond to a dimmer circuit. The sensed ac inputvoltage may be received by the integrated circuit of the conventionalcontroller at a terminal dedicated to receiving the sensed ac inputvoltage or at another terminal which performs multiple functions.Additional terminals, however, add unwanted cost and size to theconventional controller of the switched mode power supply. Circuitryexternal to the integrated circuit of the conventional controller alsoadds cost to the switched mode power supply. With the embodiments of thepresent invention, the input voltage may be indirectly sensed by usingthe current through the switch of the switched mode power supply. As aresult, using the terminal already used for one end of the switch alsoto indirectly sense the ac input voltage would remove the need for aterminal dedicated just to sensing the ac input voltage and would alsoeliminate the need for external circuitry for sensing the ac inputvoltage. That is, embodiments of the present invention may indirectlydetect input voltage zero-crossing to omit or exclude conventionalterminals that are dedicated to the direct sensing of the ac inputvoltage of the switched mode power supply.

Referring first to FIG. 1, a functional block diagram of an exampleswitching power supply 100 is illustrated including ac input voltageV_(AC) 102, a bridge rectifier 104, rectified voltage V_(RECT) 106, anenergy transfer element T1 108, a primary winding 110 of the energytransfer element T1 108, a secondary winding 112 of the energy transferelement T1 108, a switch S1 114, an input return 116, a clamp circuit118, a filter capacitor C_(F) 120, a rectifier D1 122, an outputcapacitor C1 124, an output quantity U_(O), an output voltage V_(O), anoutput current I_(O), a feedback circuit 128, a feedback signal U_(FB)130, a controller 138, a drive signal 140, a current sense input signal142, and switch current I_(D) 144. Also illustrated in FIG. 1 is a load126 coupled to the switching power supply 100. The example switchingpower supply 100 illustrated in FIG. 1 is configured generally as a flyback regulator, which is one example of a switching power supplytopology which may benefit from the teachings of the present invention.However, it is appreciated that other known topologies andconfigurations of switching power supply regulators may also benefitfrom the teachings of the present invention.

The switching power supply 100 provides output power to the load 126from an unregulated input voltage. In one example, the input voltage isthe ac input voltage V_(AC) 102. In another example, the input voltageis a rectified ac input voltage such as rectified voltage V_(RECT) 106.As shown, bridge rectifier 104 receives the ac input voltage V_(AC) 102and produces the rectified voltage V_(RECT) 106. The bridge rectifier104 further couples to the energy transfer element T1 108. In someembodiments of the present invention, the energy transfer element T1 108may be a coupled inductor. In other embodiments, the energy transferelement T1 108 may be a transformer. In the example of FIG. 1, theenergy transfer element T1 108 includes two windings, a primary winding110 and a secondary winding 112. However, it should be appreciated thatthe energy transfer element T1 108 may have more than two windings. Theprimary winding 110 is further coupled to switch S1 114, which is thenfurther coupled to input return 116. In one embodiment, the switch S1114 may be a transistor such as a metal-oxide-semiconductor field-effecttransistor (MOSFET). In another example, controller 138 may beimplemented as a monolithic integrated circuit or may be implementedwith discrete electrical components or a combination of discrete andintegrated components. Controller 138 and switch S1 114 could form partof an integrated circuit 146 that is manufactured as either a hybrid ormonolithic integrated circuit.

In addition, the clamp circuit 118 is illustrated in the embodiment ofFIG. 1 as being coupled across the primary winding 110 of the energytransfer element T1 108. The filter capacitor C_(F) 120 may coupleacross the primary winding 110 and switch S1 114. In other words, thefilter capacitor C_(F) 120 may couple to the bridge rectifier 104 andinput return 116. Secondary winding 112 of the energy transfer elementT1 108 is coupled to the rectifier D1 122. In the example of FIG. 1, therectifier D1 122 is exemplified as a diode. However, in some embodimentsthe rectifier D1 122 may be a transistor used as a synchronousrectifier. Both the output capacitor C1 124 and the load 124 are shownin FIG. 1 as being coupled to the rectifier D1 122. An output isprovided to the load 126 and may be provided as either a regulatedoutput voltage V_(O), regulated output current I_(O), or a combinationof the two.

The switched mode power supply 100 further comprises circuitry toregulate the output which is exemplified as output quantity U_(O). Ingeneral, the regulated output quantity U_(O) is either an output voltageV_(O), output current I_(O), or a combination of the two. A feedbackcircuit 128 is coupled to sense the output quantity U_(O) of theswitched mode power supply 100 and produces the feedback signal U_(FB)130. In other embodiments, the feedback signal U_(FB) 130 may be derivedfrom sensing one or more quantities on the input side of the transformerthat are representative of the output quantity U_(O). The feedbackcircuit 128 is further coupled to a terminal of the controller 138 suchthat the controller 138 receives the feedback signal U_(FB) 130. Thecontroller 138 further includes a terminal for receiving the currentsense input signal 142. The current sense input signal 142 isrepresentative of the switch current I_(D) 144 in the switch S1 114. Inaddition, the switch S1 114 receives the drive signal 140 from thecontroller 138.

In operation, the switching power supply 100 of FIG. 1 provides outputpower to the load 126 from an unregulated input such as the ac inputvoltage V_(AC) 102. The ac input voltage V_(AC) 102 is received by thebridge rectifier 104 and produces the rectified voltage V_(RECT) 106.The filter capacitor C_(F) 120 filters the high frequency current fromthe switch S1 114. For other applications, the filter capacitor C_(F)120 may be large enough such that a dc voltage is applied to the energytransfer element T1 108. However for power supplies with power factorcorrection (PFC), a small filter capacitor C_(F) 120 may be utilized toallow the voltage applied to the energy transfer element T1 108 tosubstantially follow the rectified voltage V_(RECT) 106. As such thevalue of the filter capacitor C_(F) 120 may be chosen such that thevoltage on the filter capacitor C_(F) 120 reaches substantially zeroduring each half-line cycle of the input line voltage. Or in otherwords, the voltage on the filter capacitor C_(F) 120 substantiallyfollows the positive magnitude of the ac input voltage V_(AC) 102. As aresult, the zero-crossing condition may be detected by the controller138. In addition, as will be further discussed, the on-time extensionutilized by the controller 138 removes more charge from the filtercapacitor C_(F) 120. As a result, the discharging of the filtercapacitor C_(F) 120 helps to pull down the voltage at the primarywinding 110 which may help the controller 138 to detect thezero-crossing of the ac input voltage V_(AC) 102.

The switching power supply 100 utilizes the energy transfer element T1108 to transfer voltage between the primary 110 and the secondary 112windings. The clamp circuit 118 is coupled to the primary winding 110 tolimit the maximum voltage on the switch S1 114. Switch S1 114 is openedand closed in response to the drive signal 140. It is generallyunderstood that a switch that is closed may conduct current and isconsidered on, while a switch that is open cannot conduct current and isconsidered off. In some embodiments, the switch S1 114 may be atransistor and the switch S1 114 and the controller 138 may form part ofintegrated circuit 146. In operation, the switching of the switch S1 114produces a pulsating current at the rectifier D1 122. The current in therectifier D1 122 is filtered by the output capacitor C1 124 to produce asubstantially constant output voltage V_(O), output current I_(O), or acombination of the two at the load 126. In some embodiments, the load126 is an LED array.

The feedback circuit 128 senses the output quantity U_(O) of the powersupply 100 to provide the feedback signal U_(FB) 130 to the controller138. The feedback signal U_(FB) 130 may be a voltage signal or a currentsignal and provides information regarding the output quantity U_(O) tothe controller 138. In addition, the controller 138 receives the currentsense input signal 142 which relays the switch current I_(D) 144 in theswitch S1 114. The switch current I_(D) 144 may be sensed in a varietyof ways, such for example the voltage across a discrete resistor or thevoltage across a transistor when the transistor is conducting. Thecontroller 138 utilizes the switch current I_(D) 144 indicated by thecurrent sense input signal 142 to determine zero-crossing of the acinput voltage V_(AC) 102. As will be discussed further, the controller138 then generates a zero-crossing signal which represents informationregarding the zero-crossing of the ac input voltage V_(AC) 102. Thezero-crossing signal may be used to calibrate the internal frequency ofthe controller or to determine when a phase dimming circuit is utilized.

The controller 138 outputs a drive signal 140 to operate the switch S1114 in response to various system inputs to substantially regulate theoutput quantity U_(O) to the desired value. In one embodiment, the drivesignal 140 may be a rectangular pulse waveform with varying lengths oflogic high and logic low sections, with the logic high valuecorresponding to a closed switch and a logic low corresponding to anopen switch.

Referring next to FIG. 2A, a diagram of an example waveform of therectified voltage V_(RECT) 106 of the switching power supply of FIG. 1is illustrated including a half line cycle 202, a zero-crossing voltagethreshold V_(ZC) 204, peak voltage V_(P) 205, and a portion 206. FIG. 2Billustrates the portion 206 of the example rectified voltage V_(RECT)106 and the corresponding zero-crossing signal 208.

In general, the ac input voltage V_(AC) 102 is a sinusoidal waveformwith the period of the ac input voltage V_(AC) 102 referred to as a fullline cycle. Mathematically: V_(AC)(t)=V_(P) sin(2πf_(L)t). Where V_(P)205 is the peak voltage of the ac input voltage V_(AC) 102 and f_(L) isthe frequency of the line input voltage. Or in other words, f_(L) is theline frequency of the ac input voltage V_(AC) 102. It should beappreciated that the full line cycle is the reciprocal of the linefrequency f_(L), or mathematically: full line cycle=1/f_(L). Asmentioned above, the rectified voltage V_(RECT) 106 is the resultantoutput of the bridge rectifier 104 when the input to the bridgerectifier 104 is the ac input voltage V_(AC) 102. For the examplerectified voltage V_(RECT) 106 shown in FIG. 2A, the bridge rectifier104 has converted the ac input voltage V_(AC) 102 such that the outputof the bridge rectifier 104 is of a positive magnitude, ormathematically: V_(RECT)=|V_(AC) |=|V_(P) sin(2πf_(L)t)|1. As a result,the rectified voltage V_(RECT) 106 repeats every half line cycle 202.FIG. 2A also illustrates the zero-crossing voltage threshold V_(ZC) 204.For some embodiments, the zero-crossing voltage threshold V_(ZC) 204 issubstantially equal to zero. For other embodiments, the zero-crossingvoltage V_(ZC) 204 is substantially one fifth of the peak voltage V_(P)205 of the rectified voltage V_(RECT) 106. For example, if the peakvoltage V_(P) 205 of the rectified voltage V_(RECT) 106 is substantiallyequal to 125 V, the zero-crossing voltage threshold V_(ZC) 204 issubstantially equal to 25 V. In another embodiment, the zero-crossingvoltage V_(ZC) 204 is substantially one fourth of the peak voltage V_(P)205 of the rectified voltage V_(RECT) 106. It should be appreciated thatas the value of the zero-crossing voltage threshold V_(ZC) 204 is closerto zero voltage, the more accurate the zero-crossing signal 208.However, the closer the value of the rectified voltage V_(RECT) 106 isto zero voltage the more difficult it may be for embodiments ofcontroller 138 to sense the value of the rectified voltage V_(RECT) 106.In particular, the controller 138 may have some difficulty sensing thevalue of the rectified voltage V_(RECT) 106 through the switch currentI_(D) 144 provided by the current sense input signal 142 when therectified voltage V_(RECT) 106 is at or near zero voltage. As suchembodiments of controller 138 may have a non-zero value for thezero-crossing threshold voltage V_(ZC) 204 to allow the sensing of thezero-crossing condition when the value of the rectified voltage V_(RECT)106 is at or near zero voltage. In addition, the rectified voltageV_(RECT) 106 may not reach zero due in part to the selected value of thefilter capacitor C_(F) 120.

FIG. 2B illustrates the portion 206 of the example rectified voltageV_(RECT) 106 and the corresponding zero-crossing signal 208. Thecontroller 138 indirectly senses the value of the ac input voltageV_(AC) 102 and the rectified voltage V_(RECT) 106 to produce thezero-crossing signal 208. When the rectified voltage V_(RECT) 106 isless than the zero-crossing voltage threshold 204, the zero-crossingsignal 208 changes to a state which indicates a zero-crossing conditionexists. The zero-crossing signal 208 does not change from that stateuntil the rectified voltage V_(RECT) 106 is greater than thezero-crossing voltage threshold 204. For the example shown in FIG. 2B,the zero-crossing signal 208 is a rectangular pulse waveform with logichigh and logic low sections. When the rectified voltage V_(RECT) 106 isless than the zero-crossing voltage threshold 204, the value of thezero-crossing signal 208 is logic high. When the rectified voltageV_(RECT) 106 is greater than the zero-crossing voltage threshold 204,the value of the zero-crossing signal 208 is logic low. The length oftime which the zero-crossing signal 208 indicates the zero-crossingcondition exists is denoted as the zero-crossing pulse width T_(Z) 210.For the example shown in FIG. 2B, the zero-crossing pulse width T_(Z)denotes the length of time when the zero-crossing signal 208 is logichigh.

The rectified voltage V_(RECT) 106 shown in FIG. 2A is the ac inputvoltage V_(AC) 102 with a positive magnitude, or mathematically:V_(RECT)=|V_(AC)|=V_(P) sin(2πf_(L)t)|. The time during which the valueof the rectified voltage V_(RECT) 106 is near zero voltage correspondsto when the value of the ac input voltage V_(AC) 102 is close tocrossing zero voltage hence the term zero-crossing. In other words,detecting when the rectified voltage V_(RECT) 106 is near zero voltagecorresponds to detecting when the ac input voltage V_(AC) 102 crosseszero voltage. As shown in FIG. 2B, when the rectified voltage V_(RECT)106 is less than the zero-crossing voltage threshold V_(ZC) 204 thezero-crossing signal 208 pulses high to indicate the zero-crossingcondition to the controller 138. In other words, when−V_(ZC)<V_(AC)(t)<V_(ZC), the zero-crossing signal 208 pulses high toindicate the zero-crossing condition. For embodiments of the presentinvention, the zero-crossing of the ac input voltage V_(AC) 102 isindirectly sensed by using the switch current I_(D) 144.

The switch current of various modes of operation is illustrated in FIG.3. A diagram of an example switch current waveform of the switched modepower supply of FIG. 1 is illustrated including switching period T_(S)304, a switch on-time t_(ON) 306, a switch off-time t_(OFF) 308,trapezoidal shape 310 and triangular shape 312. FIG. 3 illustrates thegeneral waveforms of the switch current I_(D) 302 with respect to timewhen the controller is operating in both continuous conduction mode(CCM) and discontinuous conduction mode (DCM). The general waveforms ofswitch current I_(D) 302 represent examples of the switch current I_(D)144 illustrated in FIG. 1.

During any switching period T_(S) 304, switch S1 114 may conduct inresponse to the drive signal 140 from the controller 138 to regulate theoutput quantity U_(O). The switching period T_(S) 304 may be separatedinto two sections of time: switch on-time t_(ON) 306 and switch off-timet_(OFF) 308. Switch on-time t_(ON) 306 denotes the portion of theswitching period T_(S) 304 where the switch S1 114 may conduct. Switchoff-time t_(OFF) 308 denotes the remaining portion of the switchingperiod T_(S) 304 when the switch S1 114 cannot conduct. The currentwaveform of FIG. 3 illustrates two fundamental modes of operation. Thetrapezoidal shape 310 is characteristic of continuous conduction mode(CCM) whereas the triangular shape 312 is characteristic ofdiscontinuous conduction mode (DCM). During CCM, the switch currentI_(D) 302 is substantially non-zero immediately after the start of theswitch on-time t_(ON) 306. At DCM, the switch current I_(D) 302 issubstantially zero immediately after the beginning of the switch on-timet_(ON) 306. During the switch off-time t_(OFF) 308, the switch currentI_(D) 302 is substantially zero for both CCM and DCM. The switchingpower supply 100 in accordance with embodiments of the present inventionmay operate in either CCM or DCM.

Referring next to FIG. 4A, a diagram of an example switch currentwaveform and resultant zero-crossing signal 432 is illustrated includingswitch current I_(D) 144, a current limit threshold I_(LIM) 402, azero-crossing current threshold I_(ZC) 404, switching cycles T⁻² 406through T₈ 426, and zero-crossing pulse width T_(Z) 434. FIG. 4Ademonstrates one example of the general waveform of switch current I_(D)144 over time when the power supply 100 is operating in discontinuousconduction mode (DCM). In general, each of the switching cycles T⁻² 406through T₈ 426 has a switching period of T_(S) 304. In some embodimentsof the present invention, the switching period of T_(S) 304 may be aconstant length of time. In other embodiment of the present invention,the controller 138 may vary the length of the switching period T_(S)304. In further embodiments of the present invention, the switchingperiod T_(S) 304 (and hence the switching frequency f_(S) where

$f_{s} = \frac{1}{T_{S}}$and the intended switch on-time t_(ON) 306 are all maintained constantfor one half line cycle 202.

For embodiments of the present invention, the controller 138 utilizesthe switch current I_(D) 144 to determine when the ac input voltageV_(AC) 102 has crossed zero voltage. FIG. 4A illustrates an example ofthe switch current I_(D) 144 over several switching cycles T⁻² 406through T₈ 426. The current limit threshold I_(LIM) 402 is the maximumcurrent permitted of the switch S1 114. If the switch current I_(D) 144reaches the current limit threshold L_(LIM) 402, the switch S1 114 turnsoff for the remainder of the switching cycle. When the switch currentI_(D) 144 does not reach the zero-crossing current threshold I_(ZC) 404by a certain amount of time, a possible zero-crossing condition mayexist.

It should be appreciated that N is the number of consecutive switchingcycles which the controller 138 detects as a possible zero-crossingcondition before determining that the zero-crossing condition does existand the zero-crossing signal 432 changes from a state indicating nozero-crossing condition to a state which indicates the zero-crossingcondition. In addition, when the zero-crossing signal 432 is indicatingthat the zero-crossing condition exists, the controller waits Nconsecutive switching cycles to allow the controller 138 to decide thatthe zero-crossing condition does not exist before the controller 138changes the state of the zero-crossing signal 432 to indicate nozero-crossing condition. The controller 138 may wait the N consecutiveswitching cycles to account for any noise ringing which could lead to afalse detection of the zero-crossing condition. For example, if N isequal to 4 (as shown in FIG. 4B), the controller 138 determines that thezero-crossing condition exists when a possible zero-crossing conditionoccurs for 4 consecutive switching cycles. In another example, if N isequal to 1 (as shown in FIG. 4A), the controller 138 determines that thezero-crossing condition exists at the first instance of a possiblezero-crossing condition. The value of N may be chosen in part due to theamount of expected noise at the input of the power supply 100. The lowerthe value of N, the more quickly the controller 138 determines that thezero-crossing condition does or does not exist, however, thedetermination of the zero-crossing condition may be more susceptible tonoise at the input of the power supply 100. As such, the zero-crossingsignal 432 may falsely indicate a zero-crossing condition or falselyindicate no zero-crossing condition of the ac input voltage V_(AC) 102.However, the value of N should not be so large that the controller 138can not detect that the zero-crossing condition exists because therectified voltage V_(RECT) 106 has fallen below the zero-crossingvoltage threshold V_(ZC) 204 and then risen above the zero-crossingvoltage threshold V_(ZC) 204 before the value of N is reached.

In one embodiment, a logic low value of the zero-crossing signal 432indicates no zero-crossing condition exists while a logic high value ofthe zero-crossing signal 432 indicates that the zero-crossing conditionexists. In another embodiment, a logic high value of the zero-crossingsignal 432 indicates no zero-crossing condition exists while a logic lowvalue of the zero-crossing signal 432 indicates that the zero-crossingcondition exists.

For the example shown in FIG. 4A, N is equal to 1 and the controller 138determines that the zero-crossing condition exists at the first instanceof a possible zero-crossing condition and changes the state of thezero-crossing signal 432 during the same switching cycle. In the exampleof FIG. 4A, the zero-crossing signal 432 changes to a state indicatingthe zero-crossing condition when the switch S1 114 turns off and switchcurrent I_(D) 144 falls to zero current. At switching cycles T⁻² 406,T⁻¹ 408, and T₀ 410, the switch current I_(D) 144 exceeds thezero-crossing current threshold I_(ZC) 404 and as a result nozero-crossing condition is detected by the controller 138. For theexample of FIG. 4A, when there is no zero-crossing condition, thezero-crossing signal 432 is a logic low value. However, at switchingcycle T₁ 412, the switch current I_(D) 144 does not reach thezero-crossing current threshold I_(ZC) 404 within a certain amount oftime. Since N is equal to 1 in the example of FIG. 4A, the controller138 determines that the zero-crossing condition exists for the ac inputvoltage V_(AC) 102. As a result the zero-crossing signal 432 changes tothe state which indicates the zero-crossing condition during switchingcycle T₁ 412. For the example of FIG. 4A, when the zero-crossingcondition exists, the zero-crossing signal 432 is a logic high value.

For switching cycles T₂ 414 through T₆ 422, the switch current I_(D) 144still does not reach the zero-crossing current threshold I_(ZC) 404 andthe controller 138 determines that the zero-crossing condition of the acinput voltage V_(AC) 102 continues to exist. As a result thezero-crossing signal 432 remains at the logic high value. At switchingcycle T₇ 424, the switch current I_(D) 144 exceeds the zero-crossingcurrent threshold I_(ZC) 404 and the controller 138 determines that nozero-crossing condition exists. Since N is equal to 1, the zero-crossingsignal 432 changes to the logic low value during switching cycle T₇ 424.For the example of FIG. 4A, the zero-crossing signal 432 changes to astate indicating no zero-crossing condition when the switch S1 114 turnsoff during switching cycle T₇ 424 and switch current I_(D) 144 falls tozero current. As shown in FIG. 4A, the zero-crossing pulse width T_(Z)434 is the length of time which the zero-crossing signal 432 indicatesthe zero-crossing condition exists and is at the logic high value.

Referring next to FIG. 4B, another diagram of the example switch currentwaveform and resultant zero-crossing signal 432 is illustrated includingswitch current I_(D) 144, current limit threshold I_(LIM) 402,zero-crossing current threshold I_(ZC) 404, switching cycles T₀ 410through T₁₀ 430, zero-crossing pulse width T_(Z) 434, and delay timet_(X) 436. FIG. 4B demonstrates one example of the general waveform ofswitch current I_(D) 144 over time when the power supply 100 isoperating in DCM. FIG. 4B also illustrates the same switch current I_(D)144 a shown in FIG. 4A, however, for FIG. 4B N is equal to 4 and FIG. 4Bshows switching cycles T₀ through T₁₀ (rather than switching cycles T⁻²through T₈ as shown in FIG. 4A). The controller 138 waits 4 consecutiveswitching cycles after a possible zero-crossing condition beforedetermining that the zero-crossing condition does exist and thezero-crossing signal 432 changes state to indicate the zero-crossingcondition. In addition, when the zero-crossing signal 432 indicates thezero-crossing condition exists, the controller 138 waits 4 consecutiveswitching cycles with no zero-crossing condition before the controller138 changes the state of the zero-crossing signal 432 to indicate nozero-crossing condition. The controller 138 waits for 4 consecutiveswitching cycles to account for any noise ringing and to ensure that thezero-crossing condition does exist. Although FIG. 4B illustrates N asbeing equal to 4, N may be any positive integer. However, it should beappreciated that the value of N should not be so large that thecontroller 138 can not detect that the zero-crossing condition existsbecause the switch current I_(D) 144 has fallen below the zero-crossingcurrent threshold I_(ZC) 404 and then risen above zero-crossing currentthreshold I_(ZC) 404 before the value of N is reached.

At switching cycle T₀ 410, the switch current I_(D) 144 exceeds thezero-crossing current threshold I_(ZC) 404 and as a result thecontroller 138 does not determine the zero-crossing condition exists andthe zero-crossing signal 432 remains at the logic low value. Duringswitching cycle T₁ 412, the switch current I_(D) 144 does not reach thezero-crossing current threshold I_(ZC) 404 within a certain amount oftime and the controller 138 determines that a possible zero-crossingcondition exists, however, the zero-crossing signal 432 still remains atthe logic low value since the controller 138 waits 4 consecutiveswitching cycles of possible zero-crossing conditions before determiningthat the zero-crossing condition exists. From the example of FIG. 4B,switch current I_(D) 144 also does not reach the zero-crossing currentthreshold I_(ZC) 404 within a certain amount of time for switchingcycles T₂ 414 through T₄ 418. Switching cycle T₄ 418 is the fourthconsecutive switching cycle which a possible zero-crossing conditionexists. As such the controller 138 determines that the zero-crossingcondition does exist for the ac input voltage V_(AC) 102 and thezero-crossing signal 432 changes to the state which indicates that thezero-crossing condition exists. For the example shown in FIG. 4B, thezero-crossing signal 432 transitions from the logic low value to thelogic high value. However, the zero-crossing signal 432 does nottransition to the logic high value until the end of the delay time t_(X)436. The delay time t_(X) 436 denotes the length of time between thecontroller 138 determining the zero-crossing condition does exist andthe controller 138 updating the zero-crossing signal 432. In oneembodiment, the delay time t_(X) 436 for the zero-crossing signal toupdate may be due to the filter used to implement the number N. In afurther embodiment, the delay time t_(X) 436 may delay the zero-crossingsignal 432 from updating until the next switching cycle. Referring backto FIG. 4A, the delay time t_(X) 436 is substantially equal to zero. Forembodiments of the present invention, a delay time t_(X) 436 of zero maybe preferred. However, embodiments of controller 138 that include adelay time t_(X) 436 of zero may require additional circuitry (notshown). Thus, some embodiments of controller 138 may include a non-zerodelay time t_(X) 436 to reduce costs and/or circuit complexity.

For switching cycles T₅ 420 and T₆ 422, the switch current I_(D) 144still does not reach the zero-crossing current threshold I_(ZC) 404 andthe controller determines that the zero-crossing condition of the acinput voltage V_(AC) 102 continues to exist and the zero-crossing signal432 remains at the logic high value. At switching cycle T₇ 424, theswitch current I_(D) 144 exceeds the zero-crossing current thresholdI_(ZC) 404 indicating that the zero-crossing condition of the ac inputvoltage V_(AC) 102 may no longer exist, however, the controller 138waits 4 consecutive switching cycles which the switch current I_(D) 144indicates that the zero-crossing condition may no longer exist beforedetermining that the ac input voltage V_(AC) 102 is no longer in thezero-crossing condition. For switching cycles T₈ 426 through T₁₀ 430,the switch current I_(D) exceeds the zero-crossing current thresholdI_(ZC) 404. Switching cycle T₁₀ 430 is the fourth consecutive switchingcycle which the zero-crossing condition may no longer exist and thecontroller 138 determines that there is no zero-crossing condition. As aresult the zero-crossing signal 432 changes to the state which indicatesthat no zero-crossing condition exists. However, the zero-crossingsignal 432 does not transition to the logic low value until the end ofthe delay time t_(X) 436. The delay time t_(X) 436 denotes the length oftime between the controller 138 determining that there is nozero-crossing condition and the controller 138 updating thezero-crossing signal 432. In a further embodiment, the delay time t_(X)436 may delay the zero-crossing signal 432 from updating until the nextswitching cycle. As shown in FIG. 4B, the zero-crossing pulse widthT_(Z) 434 is the length of time which the zero-crossing signal 432indicates the zero-crossing condition exists.

Referring next to FIG. 5, another diagram of the example switch currentwaveform and resultant zero-crossing signal 532 is illustrated includingswitch current I_(D) 144, a zero-crossing current threshold I_(ZC) 504,a zero-crossing time threshold t_(ZC) 506, switching cycles T_(M) 508through T_(M+3) 514, and zero-crossing pulse width T_(Z) 534. Inaddition, during each switching cycle T_(M) 508 through T_(M+3) 514,there is an on-time t_(ON) and an extended on-time t_(ONX) of the switchS1 114. In general, each of the switching cycles T_(M) 508 throughT_(M+3) 514 has a switching period of T_(S) 304. In some embodiments ofthe present invention, the switching period of T_(S) 304 may be aconstant length of time. In other embodiment of the present invention,the controller 138 may vary the length of the switching period T_(S)304. For the example zero-crossing signal 532 shown in FIG. 5, the valueof N is 2 and the delay time t_(X) is substantially equal to zero.

In one embodiment, the controller 138 also utilizes on-time extension ofthe switch S1 114 to determine if the zero-crossing condition exists forthe ac input voltage V_(AC) 102. The controller 138 determines that thezero-crossing condition exists when the switch current I_(D) 144 doesnot reach the zero-crossing current threshold I_(ZC) 504 within thezero-crossing time threshold t_(ZC) 506. When the switch current I_(D)144 does not reach the zero-crossing current threshold I_(ZC) 504 duringthe initial on-time t_(ON) of the switch S1 114, the controller 138extends the on-time t_(ON) until the zero-crossing current thresholdI_(ZC) 504 is reached or until the extended on-time t_(ONX) reaches thezero-crossing time threshold t_(ZC) 506. The amount of time which theon-time t_(ON) is extended by is referred to as the extended on-timet_(ONX). For some embodiments, the zero-crossing time threshold t_(ZC)506 is substantially equal to 5 μs. When choosing the value of thezero-crossing time threshold t_(ZC) 506, the zero-crossing timethreshold t_(ZC) 506 should be longer than the smallest intended on-timet_(ON) yet not be significantly longer than the switching period ofT_(S) 304. In general, the controller 138 may more accurately sense theswitch current I_(D) 144 with larger values of the zero-crossing timethreshold t_(ZC) 506.

At switching cycle T_(M) 508, the switch current I_(D) 144 does notreach the zero-crossing current threshold I_(ZC) 504 within the initialon-time t_(ON) of the switch S1 114. Instead of turning the switch S1114 off, the switch S1 114 remains on and the on-time t_(ON) of theswitch is extended until the switch current I_(D) 144 reaches thezero-crossing current threshold I_(ZC) 504 or the sum of the on-timet_(ON) and the extended on-time t_(ONX) reaches the zero-crossing timethreshold t_(ZC) 506. For switching cycle T_(M) 508, the on-time t_(ON)is extended by extended on-time t_(ONX), however, the switch currentI_(D) 144 reaches the zero-crossing current threshold I_(ZC) 504 beforethe sum of the on-time t_(ON) and the extended on-time t_(ONX) reachesthe zero-crossing time threshold t_(ZC) 506. As a result the switch S1114 is turned off when the switch current I_(D) 144 reaches thezero-crossing current threshold I_(ZC) 504 and the switch current I_(D)144 falls to substantially zero. The controller 138 does not detect thezero-crossing condition and as a result the zero-crossing signal 532indicates no zero-crossing condition.

At switching cycle T_(M+1) 510, the switch current I_(D) 144 does notreach the zero-crossing current threshold I_(ZC) 504 within the initialon-time t_(ON) and the controller 138 extends the on-time t_(ON) byextended on-time t_(ONX). As illustrated, the switch current I_(D) 144reaches the zero-crossing current threshold I_(ZC) 504 during theextended on-time t_(ONX). Unlike switching cycle T_(M) 508, the switchcurrent I_(D) 144 reaches the zero-crossing current threshold I_(ZC) 504when the sum of the on-time t_(ON) and the extended on-time t_(ONX)substantially equals the zero-crossing time threshold t_(ZC) 506. Thecontroller 138 does not detect the zero-crossing condition and thezero-crossing signal 532 remains at the logic low value.

At switching cycle T_(M+2) 512, the switch current I_(D) 144 does notreach the zero-crossing current threshold I_(ZC) 504 within the initialon-time t_(ON) and the controller 138 extends the on-time t_(ON) byextended on-time t_(ONX). As mentioned above, the controller 138 turnsthe switch S1 114 off when the zero-crossing time threshold t_(ZC) 506is reached and the switch current I_(D) 144 is less than thezero-crossing current threshold I_(ZC) 504. In the example shown in FIG.5, the switch current I_(D) 144 does not reach the zero-crossing currentthreshold I_(ZC) 504 within the initial on-time t_(ON) and thecontroller 138 extends the on-time of the switch S1 114. The on-timet_(ON) is extended until the switch current I_(D) 144 reaches thezero-crossing current threshold I_(ZC) 504 or the extended on-timet_(ONX) reaches the zero-crossing time threshold t_(ZC) 506. Forswitching cycle T_(M+2) 512, the extended on-time t_(ONX) reaches thezero-crossing time threshold t_(ZC) 506 before the switch current 144reaches the zero-crossing current threshold I_(ZC) 504. As a result, thecontroller 138 determines that a possible zero-crossing condition mayexist. However, the zero-crossing signal 532 does not change statessince the controller 138 waits 2 consecutive switching cycles ofpossible zero-crossing conditions before determining that thezero-crossing condition exists.

At switching cycle T_(M+3) 514, the switch current I_(D) 144 again doesnot reach the zero-crossing current threshold I_(ZC) 504 within theinitial on-time t_(ON) and the controller 138 further extends theon-time t_(ON) by extended on-time t_(ONX). Similar to switching cycleT_(M+2) 512, the switch current I_(D) 144 does not reach thezero-crossing current threshold I_(ZC) 504 before the extended on-timet_(ONX) reaches the zero-crossing time threshold t_(ZC) 506. Inaddition, switching cycle T_(M+3) 514 is, thus, the second consecutiveswitching cycle with a possible zero-crossing condition. As a result thecontroller 138 determines that the zero-crossing condition exists andthe zero-crossing signal 532 changes state.

The zero-crossing current threshold I_(ZC) 504 and the zero-crossingtime threshold t_(ZC) 506 are chosen to correspond to the zero-crossingvoltage threshold V_(ZC) 204. As mentioned above, the controller 138detects the zero-crossing condition when the switch current I_(D) 144does not reach the zero-crossing current threshold I_(ZC) 504 by thezero-crossing time threshold t_(ZC) 506. The zero-crossing currentthreshold I_(ZC) 504 and the zero-crossing time threshold t_(ZC) 506 arefixed such that the zero-crossing condition corresponds to the value ofthe rectified voltage V_(RECT) 106 falling below the zero-crossingvoltage threshold V_(ZC) 204. In other words, the zero-crossing currentthreshold I_(ZC) 504 and the zero-crossing time threshold t_(ZC) 506 arefixed such that the zero-crossing condition corresponds to the value ofthe ac input voltage V_(AC) 102 falling between the positivezero-crossing voltage threshold V_(ZC) 204 and the negativezero-crossing voltage threshold V_(ZC) 204, or mathematically:

-   −V_(ZC)<V_(AC)(t)<V_(ZC).

The relationship between voltage and current of the switch S1 114 whenthe switch S1 114 is ON may be expressed as:

${{V(t)} = {L_{P}\frac{\mathbb{d}{i(t)}}{\mathbb{d}t}}},$where L_(P) is the inductance of the primary winding 110. For powersupplies operating in DCM, this relationship during any switching cyclemay be further expressed as:

${V_{AC} = {L_{P}\frac{I_{PEAK}}{t_{ON}}}},$where I_(PEAK) is the peak value of the switch current I_(D) 144.However, in one switching cycle the value of V_(AC) may be considered aconstant since the on-time t_(ON) is small relative to the period of theac input voltage V_(AC) 102. As mentioned above, the zero-crossingcurrent threshold I_(ZC) 504 and the zero-crossing time threshold t_(ZC)506 are fixed and chosen to correspond to the zero-crossing voltagethreshold V_(ZC) 204 utilizing the relationship between voltage andcurrent of the switch S1 114 when the switch S1 114 is ON in DCM, ormathematically:

$V_{ZC} = {L_{P}{\frac{I_{ZC}}{t_{ZC}}.}}$

The longer the switch S1 114 is ON, the more charge is removed from thefilter capacitor C_(F) 120. Thus, the on-time extension utilized by thecontroller 138 to determine the zero-crossing time threshold t_(ZC) 506may remove more charge from the filter capacitor C_(F) 120 than acontroller without on-time extension. As a result the discharging of thefilter capacitor C_(F) 120 helps to pull down the voltage at the primarywinding 110 which may help the controller 138 to detect thezero-crossing of the ac input voltage V_(AC) 102.

Referring next to FIG. 6, a functional block diagram of an exampleswitching power supply utilizing a dimmer circuit 608 is shown includingac input voltage V_(AC) 102, energy transfer element T1 108, primarywinding 110 of the energy transfer element T1 108, secondary winding 112of the energy transfer element T1 108, switch S1 114, input return 116,clamp circuit 118, filter capacitor C_(F) 120, controller 138, drivesignal 140, current sense input signal 142, and switch current I_(D)144. In addition, the switching power supply further includes arectifier 604, a rectified voltage V_(RECT) 606, a dimmer circuit 608,and a dimmer output voltage V_(DO) 610. It should be appreciated thatthe switching power supply shown in FIG. 6 is similar to the switchingpower supply 100 shown in FIG. 1 with the added dimmer circuit 608.

The energy transfer element T1 108, primary winding 110 of the energytransfer element T1 108, secondary winding 112 of the energy transferelement T1 108, switch S1 114, input return 116, clamp circuit 118,filter capacitor C_(F) 120, controller 138, drive signal 140, currentsense input signal 142, and switch current I_(D) 144 couple and functionas described above. The dimmer circuit 608 couples to the ac inputvoltage V_(AC) 102 and produces the dimmer output voltage V_(DO) 610.The dimmer circuit 608 further couples to the rectifier 604. Rectifier604 receives the dimmer output voltage V_(DO) 610 and outputs therectified voltage V_(RECT) 606. As shown in FIG. 6, the rectifier 604 iscoupled across the filter capacitor C_(F) 120. For some embodiments ofthe present invention, the rectifier 604 is a bridge rectifier asillustrated in FIG. 1.

The dimmer circuit 608 may be utilized when the load 126 coupled to thepower supply is a light emitting diode (LED) array to limit the amountof power delivered to the power supply. As a result, the currentdelivered to the load of LED arrays is limited and the LED array dims.In one embodiment, the dimmer circuit 608 is a phase dimmer circuit. Inanother embodiment, a triac dimmer circuit may be utilized as the dimmercircuit 608. The triac dimmer disconnects the ac input voltage V_(AC)102 from the power supply when the ac input voltage V_(AC) 102 crosseszero voltage. After a given amount of time, the triac dimmer reconnectsthe ac input voltage V_(AC) 102 with the power supply. Depending on theamount of dimming wanted, the triac dimmer controls the amount of timethe ac input voltage V_(AC) 102 is disconnected from the power supply.In general, more dimming corresponds to a longer period of time duringwhich the triac dimmer disconnects the ac input voltage V_(AC) 102. Inaccordance with embodiments of the present invention, the controller 138utilizes the switch current I_(D) 144 to determine when thezero-crossing condition exists for the ac input voltage V_(AC) 102 andgenerates the zero-crossing signal. FIGS. 7A and 7B illustrate anexample of the rectified voltage V_(RECT) 606 and subsequentzero-crossing signal.

FIG. 7A illustrates the example waveform of the rectified voltageV_(RECT) 606 shown in FIG. 6 including half line cycle 702,zero-crossing voltage threshold 704, a peak voltage V_(P) 705, andportion 706. FIG. 7B illustrates the portion 706 of the rectifiedvoltage V_(RECT) 606 and the corresponding zero-crossing signal 708. Thehalf line cycle 702, zero-crossing voltage threshold V_(ZC) 704, andzero-crossing signal 708 are further examples of the half line cycle202, zero-crossing voltage threshold V_(ZC) 204, and zero-crossingsignal 208 of FIGS. 2A and 2B.

As discussed above, the ac input voltage V_(AC) 102 is a sinusoidalwaveform with the period of the ac input voltage V_(AC) 102 referred toas a full line cycle. Mathematically: V_(AC)=V_(P) sin(2πf_(L)t). WhereV_(P) 705 is the peak voltage of the ac input voltage V_(AC) 102 andf_(L) is the frequency of the line input voltage. The rectified voltageV_(RECT) 606 is the resultant output of the bridge rectifier 606 and thedimming circuit 608. For the example of FIG. 7A, the voltage level atthe beginning of each half line cycle 702 of the rectified voltageV_(RECT) 606 is substantially equal to zero voltage corresponding towhen the dimmer circuit 608 disconnects the ac input voltage V_(AC) 102from the power supply. When the dimmer circuit 608 reconnects the acinput voltage V_(AC) 102 to the power supply, the rectified voltageV_(RECT) 606 substantially follows the positive magnitude of the acinput voltage V_(AC) 102. Or mathematically: V_(RECT)=|V_(DO)|.

Similar to FIG. 2A, for some embodiments the zero-crossing voltagethreshold V_(ZC) 704 is substantially equal to zero. For otherembodiments, the zero-crossing voltage threshold V_(ZC) 704 issubstantially one fifth of the peak voltage V_(P) 705 of the rectifiedvoltage V_(RECT) 606. In one example, if the peak voltage V_(P) 705 ofthe rectified voltage V_(RECT) 606 is substantially equal to 125 V, thezero-crossing voltage threshold V_(ZC) 704 is substantially equal to 25V. In another embodiment, the zero-crossing voltage threshold V_(ZC) 704is substantially one fourth of the peak voltage V_(P) 705 of therectified voltage V_(RECT) 606. It should be appreciated that as thevalue of the zero-crossing voltage threshold V_(ZC) 704 is closer tozero voltage, the more accurate the zero-crossing signal 708. However,as discussed above with regards to FIG. 2A a non-zero value may bechosen for the zero-crossing voltage threshold V_(ZC) 704.

FIG. 7B illustrates the portion 706 of the rectified voltage V_(RECT)606 and the corresponding zero-crossing signal 708. Embodiments of thepresent invention indirectly sense the ac input voltage V_(AC) 102 toproduce the zero-crossing signal 708. When the rectified voltageV_(RECT) 606 is less than the zero-crossing voltage threshold V_(ZC)704, the zero-crossing signal 708 indicates that the zero-crossingcondition exists. The zero-crossing signal 708 is a rectangular pulsewaveform with logic high and logic low sections. For the exampleillustrated in FIG. 7B, when the rectified voltage V_(RECT) 606 is lessthan the zero-crossing voltage threshold V_(ZC) 704, the value of thezero-crossing signal 708 is logic high. When the rectified voltageV_(RECT) 606 is greater than the zero-crossing voltage threshold V_(ZC)704, the value of the zero-crossing signal 708 is logic low.

As mentioned above with respect to FIG. 2B, detecting when the rectifiedvoltage V_(RECT) 606 is near zero voltage corresponds to detecting whenthe ac input voltage V_(AC) 102 crosses zero voltage. In comparing thezero-crossing signal 708 shown in FIG. 7B to the zero-crossing signal208 shown in FIG. 2B, the zero-crossing pulse T_(Z) 710 of FIG. 7B islonger than the zero-crossing pulse T_(Z) 210 of FIG. 2B due to thedisconnection of the ac input voltage V_(AC) 102 by dimmer circuit 608.As mentioned above, the amount of dimming wanted corresponds to thelength of time during which the dimmer circuit 608 disconnects the acinput voltage V_(AC) 102 from the power supply. The longer the dimmercircuit 608 keeps the ac input voltage V_(AC) 102 disconnected from thepower supply, the longer the rectified voltage V_(RECT) 606 issubstantially equal to zero voltage. As a result, the length of thezero-crossing pulse T_(Z) 710 corresponds to the amount of dimmingprovided by the dimmer circuit 608.

Referring next to FIG. 8A, another example waveform of the rectifiedvoltage V_(RECT) 801 is illustrated including half line cycle 802,zero-crossing voltage threshold V_(ZC) 804, peak voltage V_(p) 805, andportion 806. FIG. 8B illustrates the portion 806 of the rectifiedvoltage V_(RECT) 801 and the corresponding zero-crossing signal 808.

The example waveform of the rectified voltage V_(RECT) 801 is similar tothe rectified voltage V_(RECT) 606 shown in FIG. 7A. In the example ofFIG. 7A, the rectified voltage V_(RECT) 606 is the result of the acinput voltage V_(AC) 102 which has passed through dimmer circuit 608 andrectifier 604. As mentioned with regards to FIGS. 6, 7A and 7B, therectified voltage V_(RECT) 606 is the result of the dimmer circuit 608,such as a triac dimmer, which disconnects the ac input voltage V_(AC)102 at the beginning of every half line cycle 802. However, therectified voltage V_(RECT) 801 illustrated in FIGS. 8A and 8B is aresult of a dimmer circuit 608 disconnecting the ac input voltage V_(AC)102 at the end of every half line cycle 802. As a result the rectifiedvoltage V_(RECT) 801 is substantially equal to zero voltage at the endof the half line cycle 802. At the beginning of the half line cycle 802,the rectified voltage V_(RECT) 801 substantially follows the positivemagnitude of the ac input voltage V_(AC) 102 until the dimmer circuit608 disconnects the ac input voltage V_(AC) 102 from the power supply.The value of the rectified voltage V_(RECT) 801 then discharges tosubstantially zero voltage until the beginning of the next half linecycle.

FIG. 8B illustrates the portion 806 of the rectified voltage V_(RECT)801 and the corresponding zero-crossing signal 808. The ac input voltageV_(AC) 102 is indirectly sensed through the switch current I_(D) 144 toproduce the zero-crossing signal 808. When the rectified voltageV_(RECT) 801 is less than the zero-crossing voltage threshold V_(ZC)804, the zero-crossing signal 808 indicates that the zero-crossingcondition exists.

In comparing the zero-crossing signal 808 shown in FIG. 8B to thezero-crossing signal 208 shown in FIG. 2B, the zero-crossing pulse T_(Z)810 of FIG. 8B is longer than the zero-crossing pulse T_(Z) 210 of FIG.2B due to the disconnection of the ac input voltage V_(AC) 102 by dimmercircuit 608. In comparing the zero-crossing signal 808 shown in FIG. 8Bto the zero-crossing signal 708 shown in FIG. 7B, the zero-crossingpulse T_(Z) 810 of FIG. 8B occurs towards the end of the half line cycle802 rather than at the beginning of the half line cycle 802 as shown inFIG. 7B.

Referring next to FIG. 9A, a functional block diagram of a controller938 is illustrated including feedback signal U_(FB) 930, drive signal940, current sense signal 942, a drive logic block 902, an on-timeextension block 904, a zero-crossing detector 906, a zero-crossingsignal 908, and a zero-crossing time threshold pulse ZCP 924. Thezero-crossing detector 906 further includes a clock signal 910, acomparator 914, a reference signal 916, an AND gate 917, an S-R latch918, a flip-flop 922, and an optional zero-crossing filter 926. Thecontroller 938, feedback signal U_(FB) 930, drive signal 940, andcurrent sense signal 942 are examples of the controller 138, feedbacksignal U_(FB) 130, drive signal 140, and current sense signal 142illustrated in FIGS. 1 and 6. In addition, the zero-crossing signal 908is one example of the zero-crossing signal shown in FIGS. 2, 4A, 4B, 7Band 8B. In one example, drive logic block 902 and on-time extensionblock 904 may be referred to herein collectively as a drive signalgenerator. Signal annotations drive logic output DLO 950, zero-crossingtime threshold pulse ZCP 924, and comparator output CO 952 are alsoshown in FIG. 9A and FIG. 9B. The waveforms of the respective signalsare illustrated in FIG. 10.

The controller 938, feedback signal U_(FB) 930, drive signal 940, andcurrent sense signal 942 couple and function as described above. Withinthe controller 938, the drive logic block 902 couples to the on-timeextension block 904 and the zero-crossing detector 906. The drive logicblock 902 receives the current sense signal 942 and the feedback signalU_(FB) 930 and outputs a drive logic output DLO 950 to the on-timeextension block 904. The drive logic block 902 further couples to thezero-crossing detector 906 and receives the zero-crossing signal 908.The zero-crossing detector 906 couples to and receives the current sensesignal 942. As will be explained further, the zero-crossing detector 906receives the current sense signal 942 and outputs the zero-crossingsignal 908 to the drive logic block 902.

The drive logic block 902 utilizes the feedback signal U_(FB) 930,current sense signal 942, and the zero-crossing signal 908 to generatethe drive logic output signal DLO 950 which provides informationregarding the state of the drive signal 940 and the state of thecontroller 938 to the on-time extension block 904. The on-time extensionblock 904 further couples to the zero-crossing detector 906 and receivesthe output of the comparator 914, herein referred to as comparatoroutput CO 952. In addition, on-time extension block 904 receives thezero-crossing time threshold pulse ZCP 924. The zero-crossing timethreshold pulse ZCP 924 is a rectangular pulse waveform with logic highand logic low sections. The length of the logic low section issubstantially equal to the zero-crossing time threshold t_(ZC) 506 andthe length of time between consecutive falling edges of thezero-crossing time threshold pulse ZCP 924 is substantially equal to theswitching period T_(S).

The on-time extension block 904 utilizes the received drive logic outputDLO 950, zero-crossing time threshold pulse ZCP 924, and the comparatoroutput CO 952 to output the drive signal 940. As mentioned above, thedrive signal 940 is utilized to control the switching of the switch ofthe power supply (e.g., switch S1 114 of FIG. 1). The drive signal 940is also received by the flip-flop 922 of the zero-crossing detector 906.In addition, the on-time extension block 904 implements the on-timeextension discussed with respect to FIG. 5.

The drive logic block 902 receives information regarding the switchcurrent I_(D) 144 from the current sense signal 942 and informationregarding the output quantity U_(O) from the feedback signal U_(FB) 930along with the zero-crossing signal 908. Utilizing this information, thedrive logic block 902 provides information regarding the intended drivesignal to control the turning on and turning off of the switch S1 114.In one example, the drive logic block 902 may utilize the current sensesignal 942 to determine when the switch current I_(D) 144 reaches thecurrent limit threshold I_(LIM) 402 to turn off switch S1 114. The drivelogic output DLO 950 is received by the on-time extension block 904along with the comparator output CO 952 and the zero-crossing timethreshold pulse ZCP 924. As will be further discussed, depending on thevalue of the comparator output CO 952 and the zero-crossing timethreshold pulse ZCP 924, the on-time extension block 904 may extend theon-time of the intended drive signal provided by the drive logic block902.

The zero-crossing detector 906 further includes the comparator 914 whichreceives the current sense signal 942 and the reference signal 916. Inthe example of FIG. 9A, the comparator 914 receives the current sensesignal 942 at the non-inverting input of the comparator 914 and thereference signal 916 at the inverting input of the comparator 914. Thus,in one embodiment, the current sense signal 942 being less thanreference signal 916 (and thus the output of the comparator 914 beinglow) may indicate the presence of a zero-crossing condition. The currentsense signal 942 and the reference signal 916 may be a current signal ora voltage signal. The current sense signal 942 provides informationregarding the switch current I_(D) 144. When the current sense signal942 is a current signal, the reference signal 916 may be thezero-crossing current threshold I_(ZC) 404 and the comparator 914 is acurrent comparator. As mentioned above, the switch current I_(D) 144 maybe sensed in a variety of ways, such as for example the voltage across adiscrete resistor or the voltage across a transistor when the transistoris conducting. For those examples the current sense signal 942 is avoltage signal. When the current sense signal 942 is a voltage signal,the reference signal 916 is a reference voltage that corresponds to thezero-crossing current threshold I_(ZC) 404 and the comparator 914 is avoltage comparator.

The comparator 914 is further coupled to the AND gate 917 and theon-time extension block 904. The output of the comparator 914 isreceived by the on-time extension block 904. The AND gate 917 is alsocoupled to receive the zero-crossing time threshold pulse ZCP 924. Thecircle coupled to the input of the AND gate 917 which receives thecomparator output CO 952 indicates that an inverter is coupled betweenthe comparator 914 and the AND gate 917 such that the AND gate 917receives the inverted comparator output CO 952. For example, the outputof the AND gate 917 is at the logic high value when the zero-crossingtime threshold pulse ZCP 924 is at the logic high value and thecomparator output CO 952 is at the logic low value (corresponding to theinverted comparator output CO 952 at the logic high value).

The S-R latch 918 receives the output of the AND gate 917 at the resetinput, herein also referred to as the R-input of the S-R latch 918. Inaddition, the S-R latch 918 receives the clock signal 910 at the setinput, herein also referred to as the S-input. The clock signal 910provides information regarding the switching period T_(S) and in someembodiments may come from an oscillator (not shown). The clock signal910 is a rectangular pulse signal with varying lengths of logic high andlogic low sections. The length of time between consecutive rising edgesof the clock signal 910 is substantially equal to the switching periodT_(S). Once the clock signal 910 pulses to the logic high value, theclock signal 910 quickly falls to the logic low value. As such, the S-Rlatch 918 is set at rising edge of the clock signal 910. However, theS-R latch 918 resets when the output of AND gate 917 is at the logichigh value. In other words, the latch 918 resets when the comparatoroutput CO 952 indicates that the switch current I_(D) 144 provided bycurrent sense signal 942 has not exceeded the zero-crossing currentthreshold I_(ZC) 404 provided by the reference signal 916. In theexample of FIG. 9A, the output of the S-R latch 918 is taken from theQ-bar output. As such, when the S-R latch 918 is set, the output of theS-R latch 918 is the logic low value. When the S-R latch 918 is reset,the output of the S-R latch is the logic high value.

The flip-flop 922 couples to the S-R latch 918 and receives the outputof the S-R latch 918. In one embodiment, the flip-flop 922 is a Dflip-flop. The flip-flop 922 receives the output of latch 918 at theD-input. In addition, the flip-flop 922 receives the drive signal 940 atthe clock input. The drive signal 940 is a rectangular pulse waveformwith varying lengths of logic high and logic low sections. In oneembodiment, switch S1 114 being closed (i.e. ON) corresponds to a logichigh value of the drive signal 940 while switch S1 114 being open (i.e.OFF) corresponds to a logic low value of the drive signal 940. Thecircle coupled to the clock input of the flip-flop 922 indicates thatthe flip flop 922 updates at the falling edge of the drive signal 940.In other words, the output of the flip-flop 922 updates when the switchS1 114 turns OFF. The flip-flop 922 is further coupled to thezero-crossing filter 926. As illustrated, the zero-crossing filter 926receives the output of the flip-flop 922 and outputs the zero-crossingsignal 908. The output of the flip-flop 922 is substantially equal tothe zero-crossing signal 908, however, the zero-crossing filter 926 iscoupled to reduce the noise of the output of the flip-flop 922. Inaddition, the zero-crossing filter 926 implements the number N discussedabove by preventing the zero-crossing signal 908 from indicating thatthe zero-crossing condition exists unless N number of consecutiveswitching cycles have a possible zero-crossing condition. However, whenN is equal to 1, the zero-crossing filter 926 may be omitted from thezero-crossing detector 906.

At the beginning of switching period T_(S), the current sense signal 942is less than the reference signal 916 and as such the output ofcomparator 914 is logic low. In other words, at the beginning ofswitching period T_(S), the switch current I_(D) 144 is less than thezero-crossing current threshold I_(ZC) 404. The clock signal 910 pulsesto the logic high value at the beginning of the switching period T_(S)and the output of the S-R latch 918 is set to the logic low value. Theclock signal 910 quickly pulses to the logic low value and the S-R latch918 holds the previous value. For this example, the S-R latch 918 holdsthe logic low value.

The flip-flop 922 updates when the switch S1 114 opens (i.e. is OFF). Inother words, the flip-flop 922 updates the output of the flip-flop 922to mirror the D-input of the flip-flop 922 at the falling edge of thedrive signal 940. In general, a D flip-flop updates at the rising edgeof the clock input. However, with the circle at the clock input of theflip-flop 922 to denote an inverter, the flip-flop 922 updates at thefalling edge of the drive signal 940.

If the switch current I_(D) 144 provided by the current sense signal 942does not exceed the zero-crossing current threshold I_(ZC) 404 providedby the reference signal 916 before the zero-crossing time thresholdt_(ZC) provided by the zero-crossing time threshold pulse ZCP 924 isreached (or in other words before the zero-crossing time threshold pulseZCP 924 transitions to the logic high value), the zero-crossingcondition is detected and the output of the AND gate 917 is the logichigh value. The logic high output of the AND gate 917 resets the S-Rlatch 918 and the output of the S-R latch 918 is the logic high value.At the falling edge of the drive signal 940, the flip-flop 922 updatesand the output of the flip-flop 922 forwards the logic high output ofthe S-R latch 918. In one example the output of the flip-flop 922 isfiltered by the zero-crossing filter 926 and the resultant zero-crossingsignal 908 is a logic high value. In one embodiment, the output of thezero-crossing filter 926 is updated after the delay time t_(X) 436 asdiscussed with respect to FIG. 4B. In another embodiment, the output ofthe zero-crossing filter 926 is updated at the next switching cycle. Inaddition, the zero-crossing filter 926 may implement the N number ofconsecutive switching cycles with a possible zero-crossing conditionbefore the zero-crossing detector 906 decides that the zero-crossingcondition exists. In one embodiment, zero-crossing filter 926 mayinclude logic circuits to count the number of consecutive switchingcycles where the output of flip-flop 922 is a logic high value. Thus, inone embodiment, the zero-crossing filter 926 may output thezero-crossing signal 908 that indicates the presence of a zero-crossingcondition only after N number of possible zero-crossing conditions hasoccurred, as was described above with reference to FIG. 4B. In oneembodiment, the zero-crossing filter 926 may utilize flip-flops and amultiplexer to implement the number N. In another embodiment thezero-crossing filter 926 may utilize a counter to implement the numberN. In some embodiments, the delay time t_(X) 436 discussed with respectto FIG. 4B may be due to the components utilized for the zero-crossingfilter 926. For embodiments of the present invention, a delay time t_(X)436 of zero may be preferred. However, embodiments of controller 938that include a delay time t_(X) 436 of zero may require additionalcircuitry (not shown). Thus, some embodiments of controller 938 mayinclude a non-zero delay time t_(X) 436 to reduce costs and/or circuitcomplexity.

If the switch current I_(D) 144 provided by the current sense signal 942exceeds the zero-crossing current threshold I_(ZC) 404 provided by thereference signal 916 before the zero-crossing time threshold t_(ZC)provided by the zero-crossing time threshold pulse ZCP 924 is reached(or in other words before the zero-crossing time threshold pulse ZCP 924transitions to the logic high value), the zero-crossing condition is notdetected and the output of the AND gate 917 is the logic low value. TheS-R latch 918 is not reset and the logic low value of the S-R latch 918is forwarded to the output of the flip-flop 922 at the falling edge ofthe drive signal 940. In one example, the output of the flip-flop 922 isfiltered by the zero-crossing filter 926 and the resultant zero-crossingsignal 908 is at the logic low value. In one embodiment, thezero-crossing filter 926 updates its output after the delay time t_(X)436. as discussed with respect to FIG. 4B. In another embodiment, theoutput of the zero-crossing filter 926 is updated at the next switchingcycle. In addition, the zero-crossing filter 926 may implement the Nnumber of consecutive switching cycles with no zero-crossing conditionbefore the zero-crossing detector 906 decides that the zero-crossingcondition no longer exists. For example, zero-crossing filter 926 mayinclude logic circuits to count the number of consecutive switchingcycles where the output of flip-flop 922 is a logic low value. Thus, inone embodiment, the zero-crossing filter 926 may output thezero-crossing signal 908 that indicates that the zero-crossing conditionno longer exists only after N number of switching cycles with nozero-crossing condition, as was described above with reference to FIG.4B.

Referring next to FIG. 9B, a block diagram of the on-time extensionblock 904 is illustrated including zero-crossing time threshold pulseZCP 924, drive signal 940, drive logic output DLO 950, comparator outputCO 952, an optional monostable multivibrator 954, an inverter 964, a S-Rlatch 958, an OR gate 960, a falling edge delay 961 and an AND gate 968.In addition, FIG. 9B illustrates signal annotations A 962, B 970, C 956and inverted drive logic output DLO 966. The waveforms of the respectivesignals are illustrated in FIG. 10.

The zero-crossing time threshold pulse ZCP 924, drive signal 940, drivelogic output DLO 950, and the comparator output CO 952 couple andfunction as described above. In addition, the on-time extension block904 may optionally include monostable multivibrator 954 which couples toand receives the drive logic output DLO 950. As described above, thedrive logic output DLO 950 provides the on-time extension block 904 withinformation regarding the state of the controller and the intended drivesignal. The drive logic output DLO 950 is a rectangular pulse waveformwith varying lengths of logic high and logic low sections and the lengthof time between consecutive rising edges is substantially equal to theswitching period T_(S). The monostable multivibrator 954 receives thedrive logic output DLO 950 and generates a pulse at every rising edge ofthe drive logic output DLO 950. The output of monostable multivibrator954 is denoted as signal C 956, the example waveform of which isillustrated in FIG. 10 as waveform C 1056. Monostable multivibrator 954couples to the S-R latch 958. For the example shown in FIG. 9B, themonostable multivibrator 954 couples to the S-input of the S-R latch958. The S-R latch 958 receives the output of the monostablemultivibrator 954, signal C 956, at the S-input. In another embodiment,signal C 956 may be generated by an oscillator (not shown).

In addition, the on-time extension block 904 couples to the comparatoroutput 952 and the zero-crossing time threshold pulse ZCP 924. Thecomparator output 952 is received by the falling edge delay 961 whichdelays the falling edge of the comparator output 952 by a delay time oft_(D). The falling edge delay 961 further couples to the OR gate 960 andthe output of the falling edge delay 961, denoted as signal CO, isreceived at one input of the OR gate 960. The other input of the OR gate960 receives the zero-crossing time threshold pulse ZCP 924. The OR gate960 further couples to the AND gate 968 and the output of the OR gate960, denoted as signal A 962, is received at one input of AND gate 968.

In addition, the AND gate 968 also couples to inverter 964. The inverter964 couples to and receives the drive logic output DLO 950. Inverteddrive logic output DLO 966 is outputted from the inverter 964 andreceived by AND gate 968. The AND gate 968 further couples to theR-input of the S-R latch 958. The output of the AND gate 968, denoted assignal B 970, is received at the R-input of S-R latch 958. The S-R latch958 utilizes the values at the S-input and the R-input to output thedrive signal 940.

As shown in FIG. 9B, when the comparator output CO 952 indicates thatthe switch current I_(D) 144 is less than the zero-crossing currentthreshold I_(ZC), the output of the OR gate 960 may block the AND gate968 from resetting the S-R latch 958. In other words, when thecomparator output CO 952 indicates that the switch current I_(D) 144 isless than the zero-crossing current threshold I_(ZC), the output of theOR gate 960 may block the S-R latch 958 from outputting a logic lowvalue and thus extending the on-time of the switch S1 114. As will befurther illustrated in FIG. 10, the output of the OR gate 960 blocks theS-R latch 958 from resetting, thus extending the on-time of the switchS1 114, until the comparator output CO 952 indicates that the switchcurrent I_(D) 144 has reached the zero-crossing current threshold I_(ZC)or the zero-crossing time current threshold ZCP 924 indicates that thezero-crossing time threshold t_(ZC) is reached. However, if the switchcurrent I_(D) 144 exceeds the zero-crossing current threshold I_(ZC)during the initial switch on-time provided by the drive logic output DLO950, or in other words when the drive logic output DLO 950 is at a logichigh value, the S-R latch 958 resets at the falling edge of the drivelogic output DLO 950 since the drive logic output DLO 950 providesinformation regarding the intended drive signal and the output of ANDgate 968 will only reset the S-R latch 958 when both of its inputs aresimultaneously logic high. The various waveforms of the signalsdiscussed with regards to FIGS. 9A and 9B are illustrated in FIG. 10.

Referring next to FIG. 10, various waveforms corresponding to FIGS. 9Aand 9B are illustrated. FIG. 10 illustrates the differences between thevarious waveforms of the controller 938 and on-time extension block 904to implement on-time extension for zero-crossing detection. Examplewaveforms I_(D) 1044, DLO 1050, DLO 1066, CO 1052, ZCP 1024, A 1062, B1070, C 1056, and drive signal 1040 correspond to the switch currentI_(D) 144, drive logic output DLO 950, inverter drive logic output DLO966, falling edge delayed comparator output CO, zero-crossing timecurrent threshold ZCP 924, and signal annotations A 962, B 970, C 956and drive signal 940. In addition, FIG. 10 illustrates switching cycles1002, 1004 and 1006. As illustrated, each switching cycle has aswitching period of T_(S).

For the example shown in FIG. 10, at the beginning of every switchingcycle the drive logic output DLO 1050 is at the logic high value. Inaddition, the comparator output CO 1052 is at the logic low value sincethe switch current I_(D) 1044 is less than the zero-crossing currentthreshold I_(ZC). The zero-crossing time threshold pulse ZCP 1024 is atthe logic low value at the beginning of every switching cycle. Theoutput of the OR gate 960, waveform A 1062, is at the logic low value.The AND gate 968 receives the logic low value of waveform A 1062 and theinverted drive logic output DLO 1066 (currently at the logic low value)and as a result the waveform B 1070 is the logic low value at thebeginning of every switching cycle. The monostable multivibrator 954receives the drive logic output DLO 1050 and outputs a logic high pulseshown with waveform C 1056. At the beginning of every switching cycle,the waveform C 1056 is at the logic high value while the waveform B 1070is at the logic low value. As a result the S-R latch 958 outputs thedrive signal 1040 at the logic high value and the switch S1 114 turns onand the switch current I_(D) 1044 begins to increase. The waveform C1056 quickly falls to the logic low value and the S-R latch 958 holdsthe previous value. At the beginning of every switching cycle, the S-Rlatch 958 holds the logic high value and the switch S1 114 remains on.However, S-R latch 958 outputs the logic low value and therefore turnsswitch S1 114 off when waveform B 1070 at the R-input pulses to thelogic high value. The various conditions which waveform B 1070 pulses tothe logic high value will be further discussed below.

At switching cycle 1002, the switch current I_(D) 1044 exceeds thezero-crossing current threshold I_(ZC) during the initial on-time t_(ON)provided by the drive logic output DLO 1050. Or in other words, theswitch current I_(D) 1044 exceeds the zero-crossing current thresholdI_(ZC) before the falling edge of the drive logic output DLO 1050. Whenthe switch current I_(D) 1044 exceeds the zero-crossing currentthreshold I_(ZC) the comparator output CO 1052 transitions to the logichigh value. For switching cycle 1002, waveform ZCP 1024 is still at thelogic low value when the comparator output CO 1052 transitions to thelogic high value, as a result waveform A 1062 transitions to the logichigh value. For the example switching cycle 1002, waveform B 1070 pulsesto the logic high value when the drive logic output DLO 1050 transitionsto the logic low value since the AND gate 968 receives the inverteddrive logic output DLO 1066 due to inverter 964. In other words,waveform B 1070 transitions to the logic high value when the inverteddrive logic output DLO 1066 transitions to the logic high value. At thefalling edge of the drive logic output DLO 1050, waveform B transitionsto the logic high value and the S-R latch 958 is reset and the drivesignal 1040 falls to the logic low value. As such the switch S1 114turns off and the switch current I_(D) 1044 falls substantially to zero.When the switch current I_(D) 1044 falls below the zero-crossing currentthreshold I_(ZC), the comparator output CO 1052 falls to the logic lowvalue. However, the falling edge of the comparator output CO 1052 isdelayed by a delay time of t_(D) due to the falling edge delay 961.

At switching cycle 1004, the switch current I_(D) 1044 does not exceedthe zero-crossing current threshold I_(ZC) during the initial on-timet_(ON) provided by the drive logic output DLO 1050 and the controllerextends the on-time of the switch S1 114. Or in other words, the switchcurrent I_(D) 1044 does not exceed the zero-crossing current thresholdI_(ZC) before the falling edge of the drive logic output DLO 1050 andthe comparator output CO 1052 remains at the logic low value. Asillustrated in FIG. 10, the extended on-time t_(ONX) is the length oftime between the falling edge of the drive logic output DLO 1050 andwhen the switch S1 114 turns off. In other words, the extended on-timet_(ONX) is the length of time between the falling edge of the drivelogic output DLO 1050 and the falling edge of the drive signal 1040. Inaddition, the switch current I_(D) 1044 does exceed the zero-crossingcurrent threshold I_(ZC) before the rising edge of the zero-crossingtime threshold pulse ZCP 1024. When the switch current I_(D) 1044exceeds the zero-crossing current threshold I_(ZC), the comparatoroutput CO 1052 pulses to the logic high value and the OR gate 960outputs the logic high value (illustrated in FIG. 10 as waveform A 1062transitioning to the logic high value). One input of the AND gate 968receives the logic high value from waveform A 1062 and the other inputof the AND gate 968 receives the logic high value from the inverteddrive logic output DLO 1066. As a result, waveform B 1070 transitions tothe logic high value and resets the latch 958. The drive signal 1040falls to the logic low value and turns switch S1 114 off and the switchcurrent I_(D) 1044 falls substantially to zero. When the switch currentI_(D) 1044 falls below the zero-crossing current threshold I_(ZC), thecomparator output CO 1052 falls to the logic low value. However, thefalling edge of the comparator output CO 1052 is delayed by a delay timeof t_(D) due to the falling edge delay 961.

At switching cycle 1006, the switch current I_(D) 1044 does not exceedthe zero-crossing current threshold I_(ZC) during the initial on-timet_(ON) provided by the drive logic output DLO 1050 and the controllerextends the on-time of the switch S1 114. In addition, the switchcurrent I_(D) 1044 does not exceed the zero-crossing current thresholdI_(ZC) before the rising edge of the zero-crossing time threshold pulseZCP 1024. As shown, the extended on-time t_(ONX) is the length of timebetween the falling edge of the drive logic output DLO 1050 and when theswitch S1 114 turns off. The comparator output CO 1052 remains at thelogic low value for the entire switching cycle 1006. Waveform A,therefore, transitions to the logic high value at the rising edge of thezero-crossing time threshold pulse ZCP 1024. When waveform ZCP 1024transitions to the logic high value, waveform B 1070 will transition toa logic high value, the S-R latch 958 then resets and the drive signal1040 falls to the logic low value and turns switch S1 114 off and theswitch current I_(D) 1044 falls substantially to zero.

While the invention herein disclosed has been described by means ofspecific embodiments, examples and applications thereof, numerousmodifications and variations could be made thereto by those skilled inthe art without departing from the scope of the invention set forth inthe claims.

What is claimed is:
 1. A method comprising: receiving a current sensesignal representative of a switch current through a switch coupled to anenergy transfer element of a power supply, wherein energy is transferredacross the energy transfer element to an output of the power supply inresponse to switching of the switch; comparing the current sense signalwith a reference signal representative of a zero-crossing currentthreshold; generating a zero-crossing signal in response to comparingthe current sense signal with the reference signal, wherein thezero-crossing signal indicates when a zero-crossing condition of an acline input voltage of the power supply exists; and generating a drivesignal in response to the zero-crossing signal to control the switchingof the switch to regulate the output of the power supply.
 2. The methodof claim 1, wherein the zero-crossing signal indicates that azero-crossing condition exists when a magnitude of the ac line inputvoltage of the power supply is less than a zero-crossing voltagethreshold.
 3. The method of claim 1, further comprising extending anon-time of the switch until the switch current reaches the zero-crossingcurrent threshold or until the on-time of the switch reaches azero-crossing time threshold.
 4. The method of claim 3, wherein thezero-crossing signal indicates that the zero-crossing condition of theac line input voltage exists if the switch current is less than thezero-crossing current threshold and the on-time of the switch issubstantially equal to the zero-crossing time threshold.
 5. The methodof claim 3, wherein the zero-crossing signal indicates that thezero-crossing condition of the ac line input voltage does not exist ifthe switch current reaches the zero-crossing current threshold prior tothe on-time of the switch reaching the zero-crossing time threshold. 6.The method of claim 1, further comprising detecting whether the switchcurrent is less than the zero-crossing current threshold for N number ofswitching periods before the zero-crossing signal indicates that thezero-crossing condition exists, where N is greater than zero.
 7. Themethod of claim 1, wherein the method may be utilized for the powersupply with a dimming light emitting diode (LED) array.
 8. The method ofclaim 1, further comprising detecting whether the switch current is lessthan the zero-crossing current threshold for N number of switchingperiods before the zero-crossing signal indicates that the zero-crossingcondition exists, where N is greater than
 1. 9. A controller for aswitched mode power supply, the controller comprising: a drive signalgenerator to be coupled to control switching of a switch coupled to anenergy transfer element included in the power supply to regulate anoutput of the power supply, wherein energy is transferred across theenergy transfer element to the output of the power supply in response tothe switching of the switch; and a zero-crossing detector coupled to thedrive signal generator and coupled to receive a current sense signalrepresentative of a switch current flowing through the switch, whereinthe zero-crossing detector generates a zero-crossing signal in responseto comparing the current sense signal with a reference signalrepresentative of a zero-crossing current threshold, wherein thezero-crossing signal indicates when a zero-crossing condition of an acline input voltage of the power supply exists, and wherein the drivesignal generator controls the switching of the switch in response to thezero-crossing signal.
 10. The controller of claim 9, wherein thezero-crossing signal indicates that a zero-crossing condition existswhen a magnitude of the ac line input voltage of the power supply isless than a zero-crossing voltage threshold.
 11. The controller of claim9, further comprising an on-time extension block coupled to thezero-crossing detector to extend an on-time of the switch until theswitch current reaches the zero-crossing current threshold or until theon-time of the switch reaches a zero-crossing time threshold.
 12. Thecontroller of claim 11, wherein the zero-crossing signal indicates thatthe zero-crossing condition of the ac line input voltage exists if theswitch current is less than the zero-crossing current threshold and theon-time of the switch is substantially equal to the zero-crossing timethreshold.
 13. The controller of claim 11, wherein the zero-crossingsignal indicates that the zero-crossing condition of the ac line inputvoltage does not exist if the switch current reaches the zero-crossingcurrent threshold prior to the on-time of the switch reaching thezero-crossing time threshold.
 14. The controller of claim 11, whereinthe on-time extension block further comprises a latch to be coupled toprovide a drive signal to the switch, wherein the latch is furthercoupled to be reset if the switch current reaches the zero-crossingcurrent threshold or if the on-time of the switch reaches azero-crossing time threshold.
 15. The controller of claim 9, wherein thezero-crossing detector comprises a comparator having a first inputcoupled to receive the current sense signal and a second input coupledto receive the reference signal.
 16. The controller of claim 15, whereinthe zero-crossing detector further comprises a latch coupled to be setin response to a clock signal and further coupled to be reset inresponse to an output of the comparator.
 17. The controller of claim 16,wherein the zero-crossing detector further comprises a flip-flop coupledto receive an output of the latch and coupled to receive an output ofthe drive signal generator.
 18. The controller of claim 17, wherein thezero-crossing detector further comprises a zero-crossing filter coupledto an output of the flip-flop to reduce noise in the zero-crossingsignal.